#pragma once

#include<arpa/inet.h>// 网络编成模块

//地址配置
class InetAddress
{
private:
    struct sockaddr_in addr_ {};//网络编程的ip地址的存储 
public:
    InetAddress(/* args */);
    InetAddress(const char *ip, uint16_t port);//ip和端口号

    void setsockaddr(sockaddr_in addr);
    const char* getIp();
    uint16_t getPort();
    sockaddr_in getAddr();
    
    ~InetAddress();
};
// 网络套节子配置
class Socket
{
private:
    int fd_{-1};
public:
    Socket(/* args */);
    explicit Socket(int fd);

    //服务器绑定监听和连接
    void Bind(InetAddress *addr);
    void Listen();
    //设置套节字为非阻塞模式并检查
    void setNotBolcking();
    bool isNonBolcking();
    int getFd();

    int Accept(InetAddress *addr);


    ~Socket();
};



